<script lang="ts" setup>
import { ref } from 'vue'
import jcgshDsh from './tabs/jcgsh-dsh.vue'
import jcgshYsh from './tabs/jcgsh-ysh.vue'
import { useRoute } from 'vue-router'
// ref
const jcgshDshRef = ref<InstanceType<typeof jcgshDsh>>()
const jcgshYshRef = ref<InstanceType<typeof jcgshYsh>>()

// 入参
const route = useRoute()
const activeName = ref<string>((route.query.prePage as string) || 'dsh')

// 生命周期

/*
 * 切换tab页
 */
const changeTabs = (val: string) => {
  //
  switch (val) {
    case 'dsh':
      jcgshDshRef.value?.changePageNum(1)
      break
    case 'ysh':
      jcgshYshRef.value?.changePageNum(1)
      break
    default:
      break
  }
}
</script>
<template>
  <div class="container">
    <el-tabs v-model="activeName" type="card" @tab-change="changeTabs">
      <el-tab-pane label="待审核" name="dsh" lazy>
        <jcgsh-dsh ref="jcgshDshRef" />
      </el-tab-pane>
      <el-tab-pane label="已审核" name="ysh" lazy>
        <jcgsh-ysh ref="jcgshYshRef" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<style lang="scss" scoped>
.container {
  width: 100%;
  height: 100%;
  background: #fff;
}
</style>
